var PI = Math.PI;
var util = require('util');
var fs = require('fs');
var path = require('path');
var zipeUtil = require('./zipUtil.js');

exports.area = function(req, res) {
	console.log('circle.area');
	var R = req.query.circle_r / 1;
	var area = PI * R * R;
	console.log("半径为" + R + "的圆的面积是：" + area);
	res.json({
		data: area,
		success: true
	});
};

exports.zip = function(req, res) {
	var sourcePath = path.join(__dirname, "..", "resource", "buildresult", "war");
	var targetPath = path.join(__dirname, "..", "resource", "test.zip");
	zipeUtil.zip(sourcePath, targetPath, function(err, data) {

	});
	// res.end(util.inspect({
	// 	"success": true
	// }));
	res.json({
		data: 1, //
		success: true
	});
};